<template>
	<view class="content">
		<ren-calendar :collapsible='false' ref='ren' :markDays='markDays' :open="true" :disabledAfter='true'
			@onDayClick='onDayClick'>
		</ren-calendar>

		<view>
			<view class="cell" v-for="(item,index) in dataSrous" :key='index'>
				<view class="title">
					<image class="leftimg" :src = 'item.image'></image>
					<view>{{item.name}}</view>
				</view>
				<view v-for="(items,indexs) in item.arr" :key='indexs' class="celss">
					<view class="biaoti">{{indexs +1}}.{{items.tit}}</view>
					<!-- {{items.content}} -->
					<view class="content">{{items.content}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import RenCalendar from '@/components/ren-calendar/ren-calendar.vue'
	export default {
		components: {
			RenCalendar
		},
		data() {
			return {

				curDate: '',
				markDays: [],
				dataSrous: []
			}
		},
		onReady() {
			let today = this.$refs.ren.getToday().date;
			this.curDate = today;
			console.log(today,'日期格式');
			// this.markDays.push(today);

		},
		onLoad() {
			let d = new Date();
			let m = d.getMonth() + 1
			if (m < 10){
				m = '0' + m
			}
			let date = d.getFullYear() + '-' + m + '-' + d.getDate()
			this.loadData(date)
		},
		methods: {
			onDayClick(data) {
				this.curDate = data.date;
				console.log(data);
				this.loadData(data.date)
			},
			loadData(date) {
				
				this.$u.post('Appuser/puntimeday',{
					time:date
				}).then(res => {
					console.log(res.data);
					
					this.dataSrous = res.data.rows
					// 控制首页弹窗是否显示
					// this.indexAlert.status == '1'?this.$refs.popup.open():''
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f2f2f2;
	}

	.cell {
		padding: 20rpx 0rpx;
		margin-left: 24rpx;
		width: 702rpx;
		border-radius: 20rpx;
		background-color: #FFFFFF;
		margin-top: 30rpx;

		view {
			font-size: 28rpx;
		}
		.celss{
			.biaoti{
			color: #808080;	
			padding: 10rpx 20rpx;
			margin-left: 24rpx;
			}
			.content{
				padding: 10rpx 20rpx;
				margin-left: 49rpx;
			}
		}
		.title {
			padding: 30rpx;
			display: flex;
			width: 100%;

			.leftimg {

				width: 40rpx;
				height: 40rpx;
			}
			view{
				margin-left: 20rpx;
				font-size: 28rpx;
				color: #2a5cd7;
			}
		}
	}

	.content {
		// padding-top: 50rpx;

		.change {
			display: flex;
			align-items: center;
			justify-content: center;
			margin: 0 auto;
			margin-top: 100rpx;
			height: 100rpx;
			color: #b89249;
			background-color: #21191b;
		}
	}
</style>
